package com.niiwoo.civet.trade.dto.request;

import com.alibaba.fastjson.JSON;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;

/**
 * 审核要点反欺诈请求参数
 * @author xueyuke
 * @date 2017-11-25
 */
@Setter
@Getter
public class AuditPointFackRequestDTO implements Serializable {
    private static final long serialVersionUID = 930270534389021894L;
    private static final String REQUEST_SUCCESS="0";

    /**
     * 请求处理结果
     */
    private String status;

    /**
     * 标的ID
     */
    private Long projectId;

    /**
     * 审核结果
     */
    private String auditResult;

    /**
     * 审核要点
     */
    private String auditPoints;

    /**
     * 信审要点反欺诈结果枚举
     */
    @Getter
    @AllArgsConstructor
    public enum AuditResultEnum {
        PASS("0", "通过"),
        REJECT("1", "拒绝"),
        NEED_REVIEW("2", "需要人工审核");

        private final String code;
        private final String desc;

        public String getCode() {
            return code;
        }

        public String getDesc() {
            return desc;
        }
    }

    @Override
    public String toString() {
        return JSON.toJSONString(this);
    }

    /**
     * 请求成功?
     * @return
     */
    public boolean isRequestSuccess(){
        return this.status.equals(REQUEST_SUCCESS);
    }

    /**
     * 审核通过?
     * @return
     */
    public boolean isAuditPass(){
        return this.auditResult.equals(AuditResultEnum.PASS.getCode());
    }

    /**
     * 审核拒绝?
     * @return
     */
    public boolean isAuditReject(){
        return this.auditResult.equals(AuditResultEnum.REJECT.getCode());
    }

    /**
     * 需要人工审核?
     * @return
     */
    public boolean isAuditReview(){
        return this.auditResult.equals(AuditResultEnum.NEED_REVIEW.getCode());
    }
}
